projects
/
emacs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
44ad4a1
)
Speed up logcount on bignums
author
Paul Eggert
<eggert@cs.ucla.edu>
Fri, 17 Aug 2018 02:53:21 +0000
(19:53 -0700)
committer
Paul Eggert
<eggert@cs.ucla.edu>
Fri, 17 Aug 2018 02:54:30 +0000
(19:54 -0700)
* src/data.c (Flogcount): Speed up by using the mpz equivalent
of ~X instead of -X-1.
src/data.c
patch
|
blob
|
history
diff --git
a/src/data.c
b/src/data.c
index a1215b9d6bfb19e7194c2d458978d95dfd9e9159..66f508c8f437269eefcb2a6bbd8bd6d57eca5839 100644
(file)
--- a/
src/data.c
+++ b/
src/data.c
@@
-3350,8
+3350,7
@@
representation. */)
return make_fixnum (mpz_popcount (XBIGNUM (value)->value));
mpz_t tem;
mpz_init (tem);
- mpz_neg (tem, XBIGNUM (value)->value);
- mpz_sub_ui (tem, tem, 1);
+ mpz_com (tem, XBIGNUM (value)->value);
Lisp_Object result = make_fixnum (mpz_popcount (tem));
mpz_clear (tem);
return result;